import { MessageContent } from "wukongimjssdk";
const code = 101;
export class WechatInfoContent extends MessageContent {
  url!: string; // 公众号图片
  name!: string; // 公众号名称
  desc!: string; // 公众号描述

  constructor() {
    super();
    this.contentType = code;
  }

  // 解码
  decodeJSON(content: any) {
    this.url = content["url"];
    this.name = content["name"];
    this.desc = content["desc"];
  }
  // 编码
  encodeJSON() {
    // console.log("encodeJSON >>", this.url, this.name, this.desc, this);
    return {
      url: this.url,
      name: this.name,
      desc: this.desc,
    };
  }
}

export default {
  // 消息类型名称
  name: "wecat-info",
  // 消息类型编码
  code: code,
  // 消息类型内容
  content: WechatInfoContent,
};
